//
//  GHReateTableViewCell.m
//  GodHorses
//
//  Created by Mac on 2017/11/15.
//  Copyright © 2017年 stoneobs@icloud.com. All rights reserved.
//

#import "GHReateTableViewCell.h"
@interface GHReateTableViewCell()
@property(nonatomic, strong) UILabel                     *peopleLable;
@property(nonatomic, strong) UILabel                     *allUserLable;
@property(nonatomic, strong) UILabel                     *todayLable;
@property(nonatomic, strong) UILabel                     *allLable;
@property(nonatomic, strong) STButton                     *titleButton;
@end
@implementation GHReateTableViewCell

- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{
    if (self == [super initWithStyle:style reuseIdentifier:reuseIdentifier]) {
        [self configSubView];
    }
    return self;
}
#pragma mark --subView
- (void)configSubView{
    self.backgroundColor = [UIColor whiteColor];
    
    UIView * whiteView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, UIScreenWidth, 50)];
    whiteView.backgroundColor = [UIColor whiteColor];
    [self addSubview:whiteView];
    [whiteView st_showBottomLineAndWitdh:whiteView.st_width];
    STButton * titleButton = [[STButton alloc] initWithFrame:CGRectMake(10, 0, 200, whiteView.st_height)
                                                     title:@"一级分销"
                                                titleColor:GH_firstTextColor
                                                 titleFont:15
                                              cornerRadius:0
                                           backgroundColor:nil
                                           backgroundImage:nil
                                                     image:[UIImage imageNamed:@"PC_baodanzhongxin"]];
    titleButton.titleEdgeInsets = UIEdgeInsetsMake(0, 10, 0, 0);
    self.titleButton = titleButton;
    [whiteView addSubview:titleButton];
    
    self.detailButton = [[STButton alloc] initWithFrame:CGRectMake(0, 0, 60, 25)
                                                     title:@"查看明细"
                                                titleColor:[UIColor whiteColor]
                                                 titleFont:12
                                              cornerRadius:3
                                           backgroundColor:GH_redColor
                                           backgroundImage:nil
                                                     image:nil];
    self.detailButton.contentHorizontalAlignment = UIControlContentHorizontalAlignmentCenter;
    self.detailButton.st_right = UIScreenWidth - 10;
    self.detailButton.st_centerY = whiteView.st_height / 2;
    [whiteView addSubview:self.detailButton];
    
    UIView * titleView = [[UIView alloc] initWithFrame:CGRectMake(0, whiteView.st_bottom , UIScreenWidth, 50)];
    titleView.backgroundColor = [UIColor whiteColor];
    [self addSubview:titleView];
    [titleView st_showBottomLineAndWitdh:whiteView.st_width];
    //标题
    CGFloat lableWith = UIScreenWidth / 4;
    UILabel * numLable = [self defultLableTitle:@"人数" showRigthLine:YES];
    numLable.st_left = 0;
    [titleView addSubview:numLable];
    UILabel * allUserLable = [self defultLableTitle:@"合计消费" showRigthLine:YES];
    allUserLable.st_left = 0 + lableWith;
    [titleView addSubview:allUserLable];
    UILabel * todayLable = [self defultLableTitle:@"今日返佣" showRigthLine:YES];
    todayLable.st_left = 0 + 2 *lableWith;
    [titleView addSubview:todayLable];
    UILabel * allLable = [self defultLableTitle:@"总返佣" showRigthLine:NO];
    allLable.st_left = 0 + 3 *lableWith;
    [titleView addSubview:allLable];
    
    //值
    UIView * valueView = [[UIView alloc] initWithFrame:CGRectMake(0, titleView.st_bottom , UIScreenWidth, 50)];
    valueView.backgroundColor = [UIColor whiteColor];
    [self addSubview:valueView];
    [valueView st_showBottomLineAndWitdh:valueView.st_width];
    self.peopleLable = [self defultLableTitle:@"7" showRigthLine:YES];
    self.peopleLable.st_left = 0;
    [valueView addSubview:self.peopleLable];
    
    self.allUserLable = [self defultLableTitle:@"100" showRigthLine:YES];
    self.allUserLable.st_left = 0 + lableWith;
    [valueView addSubview:self.allUserLable];
    self.todayLable = [self defultLableTitle:@"30" showRigthLine:YES];
    self.todayLable.st_left = 0 + 2 *lableWith;
    [valueView addSubview:self.todayLable];
    self.allLable = [self defultLableTitle:@"30" showRigthLine:NO];
    self.allLable.st_left = 0 + 3 *lableWith;
    [valueView addSubview:self.allLable];
}
- (UILabel*)defultLableTitle:(NSString*)title showRigthLine:(BOOL)showRigthLine{
    STLabel * titleLable = [[STLabel alloc] initWithFrame:CGRectMake(0, 0, UIScreenWidth / 4, 50)
                                                     text:title
                                                textColor:GH_firstTextColor
                                                     font:14
                                              isSizetoFit:NO
                                            textAlignment:NSTextAlignmentCenter];
    if (showRigthLine) {
        [titleLable st_showRightLine:50];
    }
    return titleLable;
    
}
@end
